# for Windows
# ruby 1.9 required

PORT = 8888
procLines = `netstat -ano`.split(/\n/)
procLines.collect do |line|
  line.split(/\s+/)
end.select do |cols|
  5 < cols.size && cols[2] == "127.0.0.1:#{PORT}"
end.each do |cols|
  pid = cols[5]
  $stderr.puts("killing PID #{pid}...")
  `taskkill /PID #{pid}`
end

spawn("dev_appserver.cmd -p #{PORT} war/")
